<!DOCTYPE html>
<html lang="zh-CN">
<head>
	{include file="Public:header" /}
	<link rel="stylesheet" href="__STATIC__/admin/assets/css/view.css"/>
    <title>栏目修改</title>
</head>
<body class="layui-view-body">
<div class="layui-content">
	<div class="layui-page-header">
		<div class="pagewrap">
			<span class="layui-breadcrumb">
				<a href="">首页</a>
				<a href="">用户</a>
				<a><cite>栏目添加</cite></a>
			</span>
			<h2 class="title">{$ruleName}</h2>
		</div>
	</div>
	<div class="layui-row">
		<div class="layui-col-lg-offset3 layui-col-lg6 layui-col-xs-offset1 layui-col-xs10">
			<form class="layui-form">
				<input type="hidden" name="id" value="{$rules.id}">
				<div class="layui-form-item">
					<label class="layui-form-label">父级：</label>
					<div class="layui-input-block">
						<select name="pid" lay-verify="required">
							<option value="0">请选择</option>
							{volist name="lists" id="lis"}
							<option value="{$lis.id}" {eq name="lis.id" value="$rulePId"}selected{/eq}>{$lis.title}</option>
							{/volist}
						</select>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">权限名称：</label>
					<div class="layui-input-block">
						<input type="text" name="title" required  lay-verify="required" value="{$rules.title}" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">方法：</label>
					<div class="layui-input-block">
						<input type="text" name="name" required  lay-verify="required" placeholder="操作方法，例如 edit" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
                    <label class="layui-form-label">状态：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status" value="1" title="开" checked>
                        <input type="radio" name="status" value="0" title="关">
                    </div>
                </div>
				<div class="layui-form-item layui-form-text">
					<label class="layui-form-label">附加条件：</label>
					<div class="layui-input-block">
						<textarea name="condition" value="{$rules.condition}" placeholder="请输入附加条件，可以为空" class="layui-textarea"></textarea>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter="edit">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
{include file="Public:footer" /}
<script type="text/javascript">
layui.use(['layer','form','jquery'], function(){
	var layer = layui.layer;
	var form = layui.form;
	//监听提交
	form.on('submit(edit)', function(data){
		var data = data.field;
		console.log(data);
		$.post("{:url('rules/edit')}",data,function(res){
			if(res.code == '1001'){
				layer.msg(res.data);
				setTimeout(function () {
					layer.close(layer.index);
					window.parent.location.reload();
				},2000);
			}else{
				layer.msg('修改失败 ');
			}
		},'json');
		return false;
	});
});
</script>
</body>
</html>